/****************************************************
          File Name:6-4.cpp
          Author: Abby Cin
          Mail: abbytsing@gmail.com
          Created Time: Thu 18 Dec 2014 09:27:42 PM CST
*****************************************************/

#include<iostream>
using namespace std;

struct bop {
    char fullname[20];
    char title[20];
    char bopname[20];
    int preference;
};

int main()
{
    bop person[2] = {
        {"abby cin",
        "free man",
        "angel",
        1},
        {"angel criss",
        "bad guy",
        "nothing",
        2}
    };

    bool exit = false;
    char choice;
    
    cout << "BoP report:\n"
        << "a. display by name\t\tb. display by title\n"
        << "c. display by bopname\t\td. display by preference\n"
        << "q. quit" << endl;

    cout << "Enter your choice:";

    for(;;)
    {
        if(exit)
            break;

        cin >> choice;

        switch(choice)
        {
            case 'a':
                for(int i = 0; i < 2; i++)
                    cout << person[i].fullname << endl;
                break;
            case 'b':
                for(int i = 0; i < 2; i++)
                    cout << person[i].title << endl;
                break;
            case 'c':
                for(int i = 0; i < 2 ; i++)
                    cout << person[i].bopname << endl;
                break;
            case 'd':
                for(int i = 0; i < 2; i++)
                {
                    switch(person[i].preference)
                    {
                        case 1:
                            cout << person[i].fullname << endl;
                            break;
                        case 2:
                            cout << person[i].bopname << endl;
                            break;
                        case 3:
                            cout << person[i].title << endl;
                            break;
                        default:
                            break;
                    }
                }
                break;
            case 'q':
                exit = true;
                break;
            default:
                break;
        }
        if(!exit)
            cout << "Next choice: ";
    }

    cout << "Bye" << endl;

    return 0;
}
